import java.util.Random;
import java.util.Scanner;

public class 开数字小游戏 {
    public static void main(String[] args) {
        //生成随机数的代码不能写到循环里面，否则会一直生成新的循环
        Random r = new Random();
        int number = r.nextInt(100) + 1;//1~100
        Scanner sc = new Scanner(System.in);//键盘录入
        while (true) {
            System.out.println("请输入你要猜的数字");
            int guessnumber = sc.nextInt();
            if (number < guessnumber) {
                System.out.println("大了");
            } else if (number > guessnumber) {
                System.out.println("小了");
            } else {
                System.out.println("猜中了！");
                break;
            }

        }
    }
}